import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/components/login'
import User from '@/components/cargo/user'
import NkgTablePreview from '@/components/cargo/nkg-table-preview/nkg-table-preview.vue'
const RateManager = () =>  import('@/components/cargo/rateManager/rateManager')
const Drag = () => import('@/components/cargo/drag/drag')
const Gjcawb = () => import('@/components/cargo/gjcawb/gjcawb')
Vue.use(Router)

export const titleMap = {
  // 张工说这里图片用绝对路径
  components: {
    title: '组件库',
    img: '/static/icon/xgncghd.png'
  },
  user: {
    title: '用户管理',
    img: '/static/icon/xcwbbtj.png'
  },
  internalLeave: {
    title: '国内出港货代',
    img: '/static/icon/xgncg.png'
  },
  gjcghz : {
    title: '国际出港货站',
    img: '/static/icon/xgjcg.png'
  }
}

export const routerMap = {
  user: {
    path: 'user',
    name: 'user',
    component: User,
    meta: {
      title: titleMap['user']
    }
  },
  password: {
    path: 'nkg-table',
    name: 'password',
    component: NkgTablePreview,
    meta: {
      title: '可编辑表格',
      parentTitle: titleMap['components']
    }
  },
  drag: {
    path: 'drag',
    name: 'drag',
    component: Drag,
    meta: {
      title: '拖曳测试',
      parentTitle: titleMap['components']
    }
  },
  rateManager: {
    path: 'rateManager',
    name: 'rateManager',
    component: RateManager,
    meta: {
      title: '费率管理',
      parentTitle: titleMap['internalLeave']
    }
  },
  gjcawb: {
    path: 'gjcawb',
    name : 'gjcawb',
    component: Gjcawb,
    meta: {
      title: '国际出港运单',
      parentTitle: titleMap['gjcghz']
    }
  }
}

let router = new Router({
  routes: [
    {
      path: '/login',
      name: 'login',
      component: Login
    }
  ]
})


export default router
